package com.demo.controller;


import com.demo.bean.vo.ResponseResult;
import com.demo.service.UserService;

import java.util.Map;

public class UserRouteHandler {
  private final UserService userService = new UserService();

  public ResponseResult getAllUsers(Map<String, String> params) throws Exception {
    return userService.getAllUsers();
  }

  public ResponseResult getUserById(Map<String, String> params) throws Exception {
    String userId = params.getOrDefault("userId", "");
    if (!userId.isEmpty()) {
      return userService.getUserById(userId);
    } else {
      return new ResponseResult(400, "Missing userId parameter", null);
    }
  }

  // 添加更多用户相关的方法
  // public ResponseResult createUser(Map<String, String> params) { ... }
}